
#CROSS=

CC=$(CROSS)gcc
CPP=$(CROSS)g++
STRIP=$(CROSS)strip

TARGET_INSTALL_DIR=./

DEMO= $(TARGET_INSTALL_DIR)/publish

.PHONY: all after-all

all: $(DEMO) after-all

after-all :
	rm -rf *.o

ZMQ_LD_PATH=../3rdpart/zmq/lib/
ZMQ_LD_LIBS= -L$(ZMQ_LD_PATH) -lzmq
ZMQ_INCLUDE_PATH=-I ../3rdpart/zmq/include


LD_LIBS = $(ZMQ_LD_LIBS) 

INCLUDE = $(ZMQ_INCLUDE_PATH)

CXXFLAGS = $(LD_LIBS) $(INCLUDE) -O2 -std=c++11 -lrt -pthread -lpthread -ldl -lm -DXLOCALE_NOT_USED=1 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -DBSD=1

TGT = $(SRC_C:.c=.o) $(SRC_CPP:.cpp=.o)

SRC_C = $(wildcard *.c)
SRC_CPP = $(wildcard *.cpp)


$(DEMO) : $(TGT) 
	$(CPP) $(TGT) $(CXXFLAGS) -Wall -o $(DEMO)
	$(STRIP) $(DEMO)


%.o:%.c
	$(CC) -c $? -s $(CXXFLAGS) -fPIC -o ./$@
%.o:%.cpp
	$(CPP) -c $? -s $(CXXFLAGS) -fPIC -o ./$@

clean :
	rm -rf *.o *.so $(DEMO)

